<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body></body>
<script>
    Function.prototype.myBind = function() {
        /* 将参数转化为数组 */
        let args = Array.prototype.slice.call(arguments);
        /* 取出第一个参数 */
        let t = args.shift();
        let self = this; // fn1.myBind() 的fn1
        return function() {
            return self.apply(t, args);
        };
    };
    let obj = {
        name: "lifds",
        age: 25
    };

    function fn1(...args) {
        console.log(this, args);
    }
    fn1.myBind(obj, [1, 2], {
        name: "zs"
    })();
</script>

</html>